<script type="text/javascript">
$(document).ready(function() {
	$("#btnReenviarEmail").on('click', function(){
		ajaxCall({
			controller : 'perfil',
			action : 'reenviarEmailUsuario',
			parameters: $('#formPersonInstance').serialize(),
			success : function(e) {
				$("#divPersonInstance").html(e);
			}
		});
		return false;
	});
});
</script>
<div id="divPersonInstance">
	<div class="row-fluid">
		<g:if test="${usuarioLogueado && usuarioLogueado.esUsuarioVerificado() }">
			<div class="span5">Usuario verificado satisfacoriamente</div>
		</g:if>
		<g:else>
			<g:set var="graboOk" value="${result.toBoolean() }" ></g:set>
			<div id="errors">
				<g:if test="${graboOk}">
					<button type="button" class="close" data-dismiss="alert">&times;</button>
					<div class="alert alert-success">Se envi&oacute; el mai!</div>
				</g:if>
				<g:else>
					<g:hasErrors bean="${usuarioLogueado}">
						<g:eachError bean="${usuarioLogueado}" var="error">
							<div class="alert alert-error" style="margin-bottom: 5px;">
								<button type="button" class="close" data-dismiss="alert">&times;</button>
								<g:message error="${error}"/>
							</div>
						</g:eachError>
					</g:hasErrors>
				</g:else>
			</div>
			<g:form id="formPersonInstance" name="formPersonInstance" controller="perfil" action="reenviarEmailUsuario">
				<g:hiddenField name="id" id="id" value="${usuarioLogueado?.id}" />
				<g:hiddenField name="esModalPerson" id="esModalPerson" value="${esModal.toBoolean() }" />
				<g:hiddenField name="graboOkPerson" id="graboOkPerson" value="${graboOk}" />
				<div id="precio">
					<div class="span12">
						<div class="control-group ${hasErrors(bean: usuarioLogueado, field: 'email', 'error') }">
							<label class="control-label" for="email">Email:</label>
							<div class="controls">
								<div class="input-prepend">
									<span class="add-on">@</span>
									<g:textField class="span12" id="email" value="${usuarioLogueado?.email}" name="email"/>
								</div>
							</div>
						</div>
					</div>
					<div class="separator"></div>
					<div align="center">
						<button id="btnReenviarEmail" name="btnReenviarEmail" class="btn btn-primary btn-large span4 centrar">Reenviar email</button>
						<g:if test="${ esModal.toBoolean()}">
							<button  data-dismiss="modal" id="btnCerrarVerificar" name="btnCerrarVerificar" class="btn btn-primary btn-large span4 centrar">Cerrar</button>
						</g:if>
					</div>
				</div>
			</g:form>
		</g:else>
	</div>
</div>